import $ from 'n-zepto';
export default{
  data(){
    return {
      subjectList: {},    //专题列表
      shelveCount: "",    //上架个数
      showeditbt: false,   //是否显示编辑按钮
      showWarnModal:false, //格式校验提示框
      warnContent:''  //提示文案
    }
  },
  mounted(){
    this.init();
  },
  methods: {
    init: function(){
      var _this = this;
      var id = _this.$route.query.subjectId;
      $(document.body).scrollTop(0);
      this.shelveCount = this.$route.query.shelveCount;
      this.showeditbt =  typeof (this.shelveCount)=="number" ? true:false
      console.log("this.showeditbt"+this.showeditbt);
      var potion = {
        subjectId: id
      };
      this.$http.post('convSubjectManage/querySubjectDetail',potion)
        .then(function(resData){
          if(resData.meta.code == '0'){
            let data=resData.data;
            _this.subjectList = data;
          }else{
            // _this.$Modal.warning({
            //   title: '温馨提示',
            //   content: resData.meta.message
            // });
            _this.showWarnModal = true;
            _this.warnContent = resData.meta.message;
          }
        })
        .catch(function(err){
          // _this.$Modal.warning({
          //   title: '温馨提示',
          //   content: err.meta.message
          // });
          _this.showWarnModal = true;
          _this.warnContent = err.meta.message;
        })
    },

    //跳转编辑页
    gotoedit: function(){
      this.$router.replace({
        name: 'subjectEdit',
        query:{
            subjectId:this.$route.query.subjectId,
          shelveCount: this.shelveCount
        }
      })
    },
    //返回上一页
    goBack:function(){
      this.$router.go(-1);
    },
    closeModal(){
      this.showWarnModal = false;
    }
  }


}
